import logger from './logger';
import router from '@ohos.router';

class page {
  navigate(view: string) {
    try {
      router.pushUrl({
        url: "pages/" + view,
        params: {}
      });
    } catch (e) {
      logger.error(e);
    }
  }

  navigateWith(view: string, paras: object) {
    try {
      router.pushUrl({
        url: "pages/" + view,
        params: paras
      });
    } catch (e) {
      logger.error(e);
    }
  }

  navigateBack() {
    try {
      router.back();
      router.clear();
    } catch (e) {
      logger.error(e);
    }
  }
}
export default new page();